package com.springboot.merlin.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @author Merlin
 * @Title: TestProperties
 * @ProjectName springboot-learning
 * @Description: 获取自定义配置文件
 * @date 2018/8/2815:36
 */
//@Data 为lombok注解 提供getter\setter\toString等方法
@Data
@Component
@PropertySource("classpath:test.properties")  //使用yml格式获取不到值
@ConfigurationProperties(prefix = "my2")
public class TestProperties {
    private String name;
    private String gender;
    private String email;
}
